package com.demo.mapper;

import com.demo.domain.URLEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by qmf on 2016/5/16.
 */
public interface URLMapper {

    @Insert("INSERT INTO T_URL(id, url) VALUES(#{id}, #{url})")
    void insertURL(URLEntity urlEntity);

    @Select("SELECT * FROM T_URL WHERE id=#{id}")
    URLEntity selectURL(@Param("id") String url);

    @Select("SELECT * FROM T_URL")
    List<URLEntity> selectURLs();

    @Delete("DELETE FROM T_URL WHERE id=#{id}")
    void deleteURL(@Param("id") String url);

    @Update("UPDATE T_URL SET url=#{url} WHERE id=#{id}")
    void updateURL(URLEntity urlEntity);

}
